<?php @session_start();?>
<?php
require_once('./safe.php');
require_once('../admin/config.php');
$conn = mysql_connect($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd);
mysql_select_db($cfg_dbname,$conn);

$country_id=$_POST["country_id"];
$company=$_POST["company"];
$vat=$_POST["vat"];
$first_name=$_POST["first_name"];
$last_name=$_POST["last_name"];
$address=$_POST["address"];
$postcode=$_POST["postcode"];
$city=$_POST["city"];
$email=$_POST["email"];

if(!empty($first_name)&&!empty($last_name)&&!empty($address)&&!empty($postcode)&&!empty($email)&&!empty($city)&&!empty($vat)){
$sql = "update ph_user set country='".$country_id."',first_name='".$first_name."',last_name='".$last_name."',company_name='".$company."',vat='".$vat."',address='".$address."',postcode='".$postcode."',city='".$city."',email='".$email."' where id='".$_SESSION["userid"]."'";
mysql_query($sql,$conn);
echo "<script language=JavaScript>\r\n";
echo "alert('Successfully saved your profile.');\r\n";
echo "location.href='/dashboard/settings.php'\r\n";
echo "</script>";

}else{
echo "<script language=JavaScript>\r\n";
echo "alert('The field is required.!');\r\n";
echo "location.href='/dashboard/settings.php'\r\n";
echo "</script>";
//header('Location: /dashboard/settings.php');
}





?>